package com.lyj.sc.dynamicProgramming.test320220718;

/**
 * @program: code-random
 * @description: 完全背包
 * @author: lyj
 * @create: 2022-07-18 11:47
 * @version: 1.0
 * @Modifier By:
 **/
public class wanquanbeibao {

    public static void main(String[] args) {
        int [] produce = {1,2,3};
        int [] value = {15,20,25};
        int bagsize = 4;
        int[] dp = new int[bagsize+1];
        for (int i = 0; i < produce.length; i++) {
            for (int j = produce[i]; j <= bagsize; j++) {
                dp[j]=Math.max(dp[j],dp[j-produce[i]]+value[i]);
            }
        }
        System.out.println(dp[bagsize]);
    }
}
